package com.chance.cc.crawler.prod.command.trigger.domain.commerce.amazon;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.core.downloader.HttpPage;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;
import com.chance.cc.crawler.prod.command.job.domain.commerce.amazon.realtime.AmazonCommentCrawlerScheduleJob;
import com.chance.cc.crawler.prod.command.job.domain.commerce.amazon.realtime.AmazonCrawlerScheduleJob;
import com.chance.cc.crawler.prod.command.trigger.CommonCrawlerSchedulerTrigger;

/**
 * @ClassName dangdang
 * @Description TODO
 * @Author songding
 * @Date 2021/10/19 16:34
 * @Version 1.0
 **/
public class AmazonCommonCrawlerScheduleTrigger extends CommonCrawlerSchedulerTrigger {
    public static void main(String[] args) {//运行工作爬虫
        publishAmazonScheduleTriggerInfo(AmazonCrawlerScheduleJob.publishCrawlerScheduleJobInfo());
//        publishAmazonCommentScheduleTriggerInfo(AmazonCommentCrawlerScheduleJob.publishWangYiCommentCrawlerScheduleJobInfo());
//        publishAmazonKeyScheduleTriggerInfo(AmazonKeyCrawlerScheduleJob.publishCrawlerScheduleJobInfo());
    }

    //文章实时采集
    public static void publishAmazonScheduleTriggerInfo(CrawlerJob crawlerJob) {//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                AmazonCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 1 * * ?", "亚马逊文章每天1点执行一次");//采集信息-
        System.out.println("添加采集调度： " + page.getRawText());//调度文本
    }

    //文章实时采集
    public static void publishAmazonCommentScheduleTriggerInfo(CrawlerJob crawlerJob) {//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                AmazonCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 3 * * ?", "亚马逊评论每天3点执行一次");//采集信息-
        System.out.println("添加采集调度： " + page.getRawText());//调度文本
    }

    //文章实时采集
    public static void publishAmazonKeyScheduleTriggerInfo(CrawlerJob crawlerJob) {//实时调度触发信息
        HttpPage page = metaServiceCommand_17.addOrUpdateScheduleCrawlerTrigger(//添加调度爬虫触发
                crawlerJob.generateCrawlerKey(),//生成爬虫key
                crawlerJob.generateCrawlerTriggerKey(),//生成爬虫触发key
                AmazonCommentCrawlerScheduleJob.domain,//工作的域
                CrawlerMetaConstant.ScheduleJobTrigger_Cron, "0 0 5 1 * ?", "亚马逊关键词每月执行一次");//采集信息-
        System.out.println("添加采集调度： " + page.getRawText());//调度文本
    }

}


